<template>
<div class="switcher">
  <span :class="{'switcher-block':true, active: mySearchResult_mode === 'card'}" @click="switchMode('card')">
    <i class="iconfont-page icon-page-kongjianbujumianban"></i>
  </span>
  <span :class="{'switcher-block':true, active: mySearchResult_mode === 'list'}" @click="switchMode('list')">
    <i class="iconfont-page icon-page-liebiao"></i>
  </span>
</div>
</template>
<script>
import {mapState} from 'vuex'
import {setViewMode} from '@/helper/cookie'
export default {
    data () {
      return {
      }
    },
    computed: {
      ...mapState(['mySearchResult_mode'])
    },
    methods: {
      switchMode(mode) {
        this.$store.commit('mySearchResult_mode', mode);
        setViewMode(mode);
      }
    }
  }
</script>